<!DOCTYPE html>
<html class="html" lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>♻同步日志 - 常用开发软件同步♻</title>
    <meta name="keywords" content="常用开发软件同步">
    <meta name="description" content="常用开发软件同步，提升国内下载速度。">
    <link rel="Shortcut Icon" href="favicon.ico">
    <link rel='stylesheet' href='statics/css/synclog.css' type='text/css'/>
</head>
<body class="content-full-screen">

<!--头部-->
<div class="header" id="Header">
    <div id="Header-Container" class="elementor-container" style="transition: all 0.4s ease-in-out 0s;">
        <ul class="mega-menu">
            <li class="mega-menu-item">
                <a class="mega-menu-link mega-menu-logo" href="index.html">
                    <img class="mega-menu-logo" width="49px" height="49px" src="logo@64.png"
                         style="padding-bottom: 5px;">
                    <span style="font-size: 25px;">常用开发软件同步</span>
                </a>
            </li>
            <li class="mega-menu-item"><a class="mega-menu-link" href="index.html">首页</a></li>
            <li class="mega-menu-item"><a class="mega-menu-link" href="#">CoolDev博客</a></li>
            <!--            <li class="mega-menu-item mega-item-align-right"><a class="mega-menu-link" href="#">下载</a></li>-->
        </ul>
    </div>
</div>

<div class="elementor-widget-wrap">
    <div class="elementor-container-note">
        <div class="elementor-element-1576422">
            <div class="elementor-element-1fc9dda">
                <div class="elementor-widget-container">
                    <p>同步日志</p>
                </div>
            </div>
            <div class="elementor-element-11070f1">
                <div class="elementor-widget-container-11070f1">
                    <div class="elementor-text-editor-11070f1">
                        <p>同步规则：每30分钟检查同步一次。</p>
                        <p>最后同步时间：<span id="lastchecktime">尚未同步</span></p>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<!--日志-->
<div class="elementor-element-f19054b" id="synclog-list">
    <!--同步日志-->
    <!--同步日志-->
    <!--同步日志-->
</div>

<!--查看更多-->
<div class="elementor-widget-container-more">
    <div class="elementor-button-wrapper-more">
        <a href="#" class="elementor-button-link-more">
            <span class="elementor-button-content-wrapper-more">
                <span class="elementor-button-text-more">查看更多👆</span>
            </span>
        </a>
    </div>
</div>
<!--分割线-->
<div class="elementor-divider">
    <span class="elementor-divider-separator"></span>
</div>
<!--底部-->
<div class="footer elementor-288">
    <div class="elementor-widget-container-footer-copyright">
        <div class="elementor-text-editor-footer-copyright">
            <p>Since 2020&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;Copyright © <a href="//cooldev.cn" target="_blank">CoolDev.cn</a>
            </p>
        </div>
    </div>
</div>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/dayjs@1.8.25/dayjs.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/cooldev-cn/cdn@master/js/tucao.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/fingerprintjs2@2.1.0/fingerprint2.min.js"></script>
<script src="statics/js/jquery.template.min.js"></script>
<script src="statics/js/polyfill.js"></script>
<script src="statics/js/functions.js"></script>
<script type="text/template" id="temp-log-item">
    <% list.forEach(function(dateItem, date, idx) { %>
    <section class="elementor-element-9164a0f">
        <div class="elementor-container-f19054b">
            <div class="elementor-row-f19054b">
                <div class="elementor-widget-wrap-f19054b">
                    <!--侧边日期-->
                    <div class="elementor-text-editor-f19054b">
                        <p>
                            <span style="font-size: 26px; line-height: 32px;"><%= date.split('-')[1] %>月</span>
                            <br/>
                            <span style="font-size: 32px; line-height: 32px;"><%= date.split('-')[2] %></span>
                            <br/>
                            <span style="font-size: 18px; line-height: 27px;"><%= date.split('-')[0] %></span>
                        </p>
                    </div>
                    <div class="elementor-element-048a814">
                        <div class="elementor-widget-container-048a814">
                            <div style="border-left:1px solid #DEDEDE;height:100px;"></div>
                        </div>
                    </div>
                </div>

                <div class="elementor-element-5acc337">
                    <div class="elementor-column-wrap-5acc337">
                        <!--主标题-->
                        <div class="elementor-widget-container-main-title-5acc337">
                            <div class="elementor-text-editor-main-title-5acc337">
                                <p><%= countUpdateNum(dateItem) %>个更新</p>
                            </div>
                        </div>
                        <% if(Object.prototype.toString.call(dateItem) === '[object Array]') {%>
                                <!--更新内容-->
                                <div class="elementor-widget-container-log-5acc337">
                                    <div class="elementor-text-editor-log-5acc337">
                                        <p>
                                            <% dateItem.forEach(function(updateItem, idx) { %>
                                            <span class="tip <%= colorLoop(idx) %>"><%= updateItem.platformshowname %></span>
                                            <span class="tip <%= colorLoop(idx) %>">v<%= updateItem.version %></span>
                                            <%= updateItem.filename %>
                                            <br/>
                                            <% }); %>
                                        </p>
                                        <p></p>
                                    </div>
                                </div>
                        <% } else { %>
                                <% dateItem.forEach(function(softItem, softname, idx) { %>
                                <!--副标题-->
                                <div class="elementor-widget-container-sub-title-5acc337">
                                    <div class="elementor-text-editor-sub-title-5acc337">
                                        <p><%= softname %></p>
                                    </div>
                                </div>
                                <!--更新内容-->
                                <div class="elementor-widget-container-log-5acc337">
                                    <div class="elementor-text-editor-log-5acc337">
                                        <p>
                                            <% softItem.forEach(function(updateItem, idx) { %>
                                            <span class="tip <%= colorLoop(idx) %>"><%= updateItem.platformshowname %>
                                            </span><span class="tip <%= colorLoop(idx) %>">v<%= updateItem.version %></span>
                                            <%= updateItem.filename %>
                                            <br/>
                                            <% }); %>
                                        </p>
                                        <p></p>
                                    </div>
                                </div>
                                <% }); %>
                        <% }%>

                    </div>
                </div>

            </div>
        </div>
    </section>
    <% }); %>
</script>
<script>
    // url: synclog.html?app=软件名
    var APPNAME = '';

    function getQueryString(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
        var r = window.location.search.substr(1).match(reg);
        if (r != null) return unescape(r[2]);
        return null;
    }

    APPNAME = getQueryString('app');
    if (APPNAME !== null && APPNAME !== '') {
        APPNAME = getQueryString('app').toLowerCase();
    } else {
        APPNAME = '';
    }

    if (document.domain == 'localhost' || document.domain == '127.0.0.1') {
        var APIEndPoint = '..';
    } else {
        var APIEndPoint = '';
    }
    var DATAURL = APIEndPoint + '/data/' + APPNAME;

    $.ajax({
        url: DATAURL + '/lastchecktime.json',
        dataType: "json",
        type: "get",
        cache: false,
        success: function (a) {
            $('#lastchecktime').html(dayjs.unix(a.timestamp).format('YYYY-MM-DD HH:mm:ss'));
        },
        error: function () {
            $('#lastchecktime').html("等待更新");
        }
    });

    $.ajax({
        url: DATAURL + '/synclog.json',
        dataType: "json",
        type: "get",
        cache: false,
        success: function (a) {
            renderGlobalSyncLog(a);
        },
        error: function () {

        }
    });

    function renderAppSyncLog() {

    }

    function renderGlobalSyncLog(log) {
        $('#synclog-list').html($.fn.render($('#temp-log-item').html(), {list: log}));
    }


    window.onscroll = function () {
        stickHeader()
    };
    var header = document.getElementById("Header");
    var header_container = document.getElementById("Header-Container");
    var sticky = header.offsetTop;

    function stickHeader() {
        if (window.pageYOffset > sticky) {
            header.classList.add("sticky");
            header_container.classList.add("sticky-contaier-height");
        } else {
            header.classList.remove("sticky");
            header_container.classList.remove("sticky-contaier-height");
        }
    }

    /**
     * 统计更新数量
     * @param item
     * @returns {number}
     */
    function countUpdateNum(item) {
        let count = 0;
        if (Object.prototype.toString.call(item) === '[object Object]') {
            item.forEach(function (childItem, key, idx) {
                count += countUpdateNum(childItem);
            });
            // Object.prototype.toString.call(str)=="[object String]"
        } else if (Object.prototype.toString.call(item) === '[object Array]') {
            count += item.length;
        }
        return count;
    }

    function colorLoop(idx) {
        let colors = ['important', 'fix', 'add', 'change', 'complete'];
        return colors[idx % colors.length];
    }
</script>
<!--[if lt IE 9]>
<script type='text/javascript'
        src='https://www.yinxiang.com/new/wp-content/themes/oceanwp/assets/js/third/html5.min.js?ver=1.0.0'></script>
<![endif]-->
</body>
</html>
